#ifndef _BIT_STACK_H_

#define _BIT_STACK_H_

#include <stdio.h>
#include <stdlib.h>

// it is assumed that bits_pre_char === bits_pre_byte === 8
#define BITS_PRE_BYTE 8

struct BitStackStruct{
	int capacity, top;
	unsigned char *stack_body;
};

typedef struct BitStackStruct BitStack;

BitStack *CreateBitStack(int capacity);

void DisposeBitStack(BitStack *s);

int BitStackPush(BitStack *s, unsigned char bit);

int BitStackPop(BitStack *s, unsigned char *dataPopped);

void BitStackShow_TopDown(BitStack *s);

int BitStackCopyStackBottomToTopTo(BitStack *s, unsigned char *dst);

void _ShowBits(unsigned char *d, int n);

#endif
